package com.publishproject.test;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.WindowManager;

import com.publishproject.YqApplication;

/**
 * @author Android客户端组-tanghongbin
 * @Title: WindowUtil
 * @Package com.publishproject.test
 * Copyright: Copyright (c) 2016
 * Company: 成都壹柒互动科技有限公司
 * @date 2017/1/13 16:56
 * @Description: TODO
 */
public class WindowUtil {
    private static DisplayMetrics displayMetrics;

    private static void window() {
        if (displayMetrics == null) {
            displayMetrics = new DisplayMetrics();
            WindowManager windowManager = (WindowManager) YqApplication.getInstance().getSystemService(Context.WINDOW_SERVICE);
            windowManager.getDefaultDisplay().getMetrics(displayMetrics);
        }
    }

    public static DisplayMetrics getDisplayMetrics() {
        window();
        return displayMetrics;
    }
}
